/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.db.mdm;

/**
 *
 * @author srkrishnan
 */
public class MDMAuditThread implements Runnable {

    protected MDMConnection auditConnection;
    protected MDMConnection repoConnection;
    protected String TableName;

    /**
     * Get the value of TableName
     *
     * @return the value of TableName
     */
    public String getTableName() {
        return TableName;
    }

    /**
     * Set the value of TableName
     *
     * @param TableName new value of TableName
     */
    public void setTableName(String TableName) {
        this.TableName = TableName;
    }

    /**
     * Get the value of repoConnection
     *
     * @return the value of repoConnection
     */
    public MDMConnection getRepoConnection() {
        return repoConnection;
    }

    /**
     * Set the value of repoConnection
     *
     * @param repoConnection new value of repoConnection
     */
    public void setRepoConnection(MDMConnection repoConnection) {
        this.repoConnection = repoConnection;
    }

    /**
     * Get the value of auditConnection
     *
     * @return the value of auditConnection
     */
    public MDMConnection getAuditConnection() {
        return auditConnection;
    }

    /**
     * Set the value of auditConnection
     *
     * @param auditConnection new value of auditConnection
     */
    public void setAuditConnection(MDMConnection auditConnection) {
        this.auditConnection = auditConnection;
    }

    public MDMAuditThread(MDMConnection auditConnection, MDMConnection repoConnection, String TableName) {
        this.auditConnection = auditConnection;
        this.repoConnection = repoConnection;
        this.TableName=TableName;
    }

    public void run() {
        /*get record from audit table in xml format*/
        AuditRecord auditrecord=auditConnection.getAuditRecordinXML(auditConnection,TableName);
        if(!auditrecord.getDbxml().equals(""))
        {
            auditrecord.setName(auditConnection.getName());
            System.out.println(auditrecord.getDbxml());
            repoConnection.insertAuditRecordintoRepo(repoConnection, auditrecord);
        }
    }
}
